var path = require('path'),
    webpack = require('webpack');

//var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
module.exports = {
    entry: ['babel-polyfill','./app/app.js'],
    output: {
        path: __dirname,
        filename: "bundle.js"
    },
    devServer:{
        port : 9013
    },
    plugins : [
        // new webpack.optimize.UglifyJsPlugin({
        //     compress: {
        //         warnings: false
        //     }
        // {
    ],
    //externals : {
    // 'react': 'React',
    // 'antd': 'antd'
    //},
    resolve:{
        extensions : ['','.js','.webpack.js', '.web.js', '.js', '.jsx'],
        alias : {
            filter:__dirname+'/public/filter.js',
            util : __dirname+'/public/util.js',
            json2 : __dirname+'/public/json2.js',
            kpl : __dirname+'/components/index.js',
            menu : __dirname+'/data/menu.js',
            menudata:__dirname+'/data/menudata.js',
            sys_dict: __dirname+'/data/sys_dict.js',
           // role : __dirname+'/data/role.js',
             react : path.join(__dirname, 'node_modules', 'react')
        }
        //modulesDirectories: ["web_modules", path.join(__dirname, '../web_modules')]
    },
    module: {
        loaders: [
            {
                test: [/\.jsx$/],
                loaders: ["jsx-loader?insertPragma=React.DOM&harmony"],
            },
        {
            test: /\.js/,
            exclude: /node_modules/,
            include:__dirname,
            loader: 'babel',
            query: {
                presets: ['react','es2015'],
                plugins: ['antd',"transform-decorators-legacy"]
            }
        },{
            test: /\.css/,
            include:__dirname,
            loader : "style!css"
        },{
            test: /\.scss/,
            exclude: /node_modules/,
            include:__dirname,
            loader : "style!css!sass"
        },{
            test: /\.(jpg|png)$/,
            loader: "url"
        }, {
                test   : /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
                loader : 'file-loader'
        }
    ]
    }
}
// // 这个插件用来寻找相同的包和文件，并把它们合并在一起
// new webpack.optimize.DedupePlugin(),
//
//     // 这个插件根据包/库的引用次数来优化它们
//     new webpack.optimize.OccurenceOrderPlugin(),
//
//     // 这个插件用来阻止Webpack把过小的文件打成单独的包
//     new webpack.optimize.MinChunkSizePlugin({
//         minChunkSize: 51200, // ~50kb
//     }),
